<?php
include_once("db_connect.php");
$postdata = file_get_contents("php://input");
if (isset($postdata) && !empty($postdata)) {
    $request = json_decode($postdata);
    $user_id = trim($request->user_id);
    $username = trim($request->username);
    $password = trim($request->password);
    $phone = trim($request->phone);
    $privileges = trim($request->privileges);
    
    $sql = "UPDATE login_user SET username = '$username', password = '$password', phone = '$phone', accesstoken = '$privileges' WHERE user_id = '$user_id'";

    if ($mysqli->query($sql)) {
        $data = array('message' => 'Update User Success');
        echo json_encode($data);
    } else {
        $data = array('message' => 'Update User Falied');
        echo json_encode($data);
    }
}

